home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-27 | 53.6 KB | 1,566 lines |
-
- Power LOGO
- Release 1.1
- by Gary Teachout
-
-
- DISTRIBUTION * * * * * * * * * * * * * * * * * * * * * *
-
- Copyright 1990 by Gary Teachout
-
- This program is freeware, and may be distributed freely. It may be
- distributed along with other freely distributable software. It may not be
- sold for profit, or included as part of a commercial software product.
- Power LOGO should be distributed together with the entire contents of the
- "PowerLOGO" directory. No donations are required but they would be accepted
- and appreciated.
-
- Contents of the "PowerLOGO" directory:
-
- LOGO The Power LOGO interpreter.
- LOGO-Startup The startup file to initialize LOGO.
- Users-Guide This doc file.
- Quick-Ref A categorized list of the Power LOGO primitives.
- Whats-New Changes since release 1.0.
- Utilities Some useful LOGO programs, ect.
- Utilities.doc About the Utilities file.
- PathMaster (dir) Doc files for the PathMaster file selector
- by Justin V. McCormick.
- ILBM.Library A library for loading and saving pictures, by Software
- Dissidents. This should be placed in the libs
- directory on your Workbench disk.
-
-
- DISCLAIMER * * * * * * * * * * * * * * * * * * * * * *
-
- THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
- EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO ITS FITNESS FOR ANY
- PARTICULAR PURPOSE. This software is experimental and IT HAS DEFECTS, if
- you do not accept all of the risks and responsibilities of using defective
- software, then DO NOT USE THIS.
-
-
- POWER LOGO? * * * * * * * * * * * * * * * * * * * * * *
-
- Power LOGO is an experimental dialect of the LOGO programming language,
- with a few lisp like features, and a few simplifications. I tried to make
- few assumptions about how you may want to use this language, wherever
- possible features are provided as options.
- User defined procedures are not limited to a fixed number of inputs,
- they may be defined with required inputs, optional inputs, and local
- variables.
- User defined procedures are just variables that contain a special type
- of list, and are defined using the "make" primitive (Power LOGO has no "to"
- or "end" primitive). This allows procedures to be processed as data.
- Syntax is Straight Polish (prefix only), inputs to a procedure follow to
- the right of the procedure name. There is no infix arithmetic, no special
- delimiters, and no exceptions in syntax. All LOGO objects (words, lists,
- list brackets, and parenthesis) must be separated by a space, or by a
- linefeed.
- Much of the Amiga graphics capability is supported. Primitives are
- provided to open custom intuition screens and windows, draw lines,
- patterned lines, text, flood fills, copy regions, and for turtle graphics.
- All primitives and keywords are lower case, all names and data defined
- may be any case. Most other versions of LOGO (and Lisp) promote all text to
- upper case on input.
- Demons (high-level interupts) may be programmed to respond to events
- from the keyboard, menus, left mouse button, and window close gadgets.
- There is no built-in text editor. LOGO stores programs as ASCII text
- files, which may be created and modified using any text editor. Or you may
- type them at the command window.
- Menus may be attached to any window. Along with menu demons this allows
- LOGO programs to have friendly user interfaces. You may customize the LOGO
- user interface by attaching your own menus to the LOGO command window.
- Properties are just variables that contain a special type of list.
- Properties give LOGO a data base like capibility.
- Support for Workbench, and CLI arguments is provided by the "argslist"
- primitive, but LOGO does nothing with this information, it is up to a
- program running in LOGO to make use of this capability. The default
- "LOGO-Startup" file will load any files named as arguments when LOGO is
- first run.
- Power LOGO provides many primitives not typicaly found in LOGO.
- Primitives for arithmetic (frac, log, power...), flow of control (cond,
- dowhile, whenmenu, while...), words and lists (alphap, items, repitem,
- represt, restof...), and others.
-
-
- REQUIREMENTS * * * * * * * * * * * * * * * * * * * * * *
-
- Power LOGO should run on most Amiga computers, it requires about 250 K
- bytes, but can use all available memory if needed. To use the "saveimage",
- and "loadimage" commands, your LIBS: directory must contain the
- "ILBM.Library" by Software Dissidents.
-
-
- GETTING STARTED * * * * * * * * * * * * * * * * * * * * * *
-
- LOGO may be run in the usual way from the WorkBench or the CLI. You may
- exit LOGO by entering the quit command.
- If a file called LOGO-Startup is found in the same directory with LOGO
- it will be loaded to initialize LOGO. This file should contain LOGO code
- that may be used to configure LOGO the way you like, and to load your own
- frequently used procedures, and data.
- LOGO opens a window on the workbench screen as its command input and
- output window. You may enter and edit LOGO commands with these special
- keys.
-
- Backspace Delete character to the left of the cursor.
- Cursor Right Move cursor right one space.
- Cursor Left Move cursor left one space.
- Cursor Up Move backward through the command history.
- Cursor Down Move forward through the command history.
- Control-G Stop program, return to top level.
- Control-K Delete from cursor to end of line.
- Control-U Delete from cursor to start of line.
- Control-X Delete the line.
- Delete Delete character under the cursor.
- Return Enter list or instructions.
- Shift Cursor Right Move cursor to end of line.
- Shift Cursor Left Move cursor to start of line.
-
- The "? " prompt means LOGO is waiting for a command. If the command
- line contains an open list (an open bracket " [ " without a closing
- bracket " ] ") you will see the "1 > " prompt allowing you to continue the
- list on another line.
-
-
- PROGRAMMING * * * * * * * * * * * * * * * * * * * * * *
-
- In the Power LOGO programming environment, everything is either a word
- or a list. Words can be any sequence of characters. Words are separated
- from each other by blank spaces, to include a space (or a backslash) in a
- word it must be preceded by a backslash (\). Numbers are just a special
- type of word. Numbers prefixed with an "@" symbol will be recocnized by
- some procedures as pointers. Lists can be any sequence of objects, which
- may be ether words or lists. Lists are identified by enclosing them in
- brackets "[]".
-
- This-is-a-word!
- [ This is a list! ]
-
- Words and lists may be either data or instructions. An instruction is a
- procedure name followed by any inputs the procedure may require. When LOGO
- tries to evaluate a word it may treat it in one of three ways, as a
- literal, as a variable, or as a procedure. Words preceded by a quote (")
- character (called quoted words) are literal and evaluate as the word
- itself. For words that happen to be numbers or pointers the quote is not
- needed. Words preceded by a colon (:) character (called dotted words) refer
- to the contents (binding) of a variable name. A word by itself (no dots or
- quote) is evaluated as a procedure (unless it is a number or pointer).
-
- ? print 123
- 123
-
- Here "print" is a procedure, and the number "123" is its input. The "print"
- procedure simply prints its inputs on next line in the command window.
-
- ? print [ This is a list! ]
- This is a list!
-
- In this example the list (everything between the brackets) is the input to
- the "print" command.
-
- ? print "This-is-a-word!
- This-is-a-word!
-
- In this example the quote (") identifies the input as a literal word.
- The inputs to a procedure need not be literal, they may be the contents
- of a variable, or the output of another instruction. Instructions may be
- nested as inputs within other instructions.
-
- ? pr * 7 6
- 42
-
- Here "*" is another procedure "6" and "7" are its inputs. "*" outputs the
- product of its inputs to pr ("pr" is just an abbreviation for "print")
- which prints it on the next line.
-
- ? make "x 100
- ? pr :x
- 100
-
- In the first line the "make" procedure assigns 100 as the contents of the
- variable "x". In the second line ":x" refers to the contents of "x".
- Each procedure has some number of required inputs (zero or more), and
- some number of optional inputs (zero or more). To include optional inputs
- the entire instruction must be enclosed in parenthesis. If only the
- required inputs are used, the parenthesis are not needed. Print requires
- one input but may have many.
-
- ? ( pr "PI "= 3.1415 )
- PI = 3.1415
-
- In this instruction "pr" has three inputs.
-
- ? ( pr [ And the answer is ] * 4 ( + 1 2 3 ) )
- And the answer is 24
-
- This entire line is one instruction where "pr" has two inputs, the first
- is the list "[ And the answer is ]", the second is the instruction
- "* 4 ( + 1 2 3 )". This second instruction "*" has two inputs "4" and
- another instruction "( + 1 2 3 )".
- Primitives are the procedures that are bult-in to LOGO. You may define
- your own procedures and add them to LOGO. In Power LOGO a procedure is just
- a variable that contains a special type of list, and may be defined using
- the "make" primitive. The first item in a procedure definition list is the
- word procedure. The second item is a list of lists of names of the inputs
- and local variables used by the procedure (the names list). The rest of the
- items in the definition are the instructions executed by the procedure.
-
- ? make "hello [ procedure [ ] pr [ Hello World ! ] ]
- ? hello
- Hello World !
-
- Because this example procedure uses no inputs or local variables the names
- list may be empty.
- The first item of the variable names list is a list of required inputs.
- The second item is a list of optional inputs or a name to receive a list of
- optional inputs. The third item is a list of names of local variables.
- Local variables and unused optional inputs contain the empty list at the
- start.
-
- ? make "hello [
- 1 > procedure [ [ ] [ :n ] ]
- 1 > repeat if numberp :n [ :n ] [ 1 ] [
- 2 > pr [ Hello World ! ] ] ]
-
- ? hello
- Hello World !
-
- ? ( hello 3 )
- Hello World !
- Hello World !
- Hello World !
-
- ? ( hello 0 )
-
- This example uses one optional input. See the example files for other forms
- of names lists.
- Global, free, and local variables all work as they would in lisp. All
- variable names in a procedure names list are local within each call to that
- procedure. They are free variables to all procedures called from within
- that procedure or at a lower level.
- A procedure that includes a call to itself is called a recursive
- procedure.
-
- ? make "factorial [
- 1 > procedure [ [ :f ] ]
- 1 > output if < 1 :f [ * :f factorial - :f 1 ] [ :f ] ]
- ? factorial 5
- 120
-
- This procedure uses recursion to compute the factorial of its input.
- A procedure in which the recursive call is the last instruction is
- called tail recursive. Tail recursion is handled differently by LOGO
- because the local variables need not be preserved. Two cases are
- recognized as tail recursion, a recursive call as the input to an "output"
- command, or a recursive call followed by a "stop" command.
-
- ? make "count100 [
- 1 > procedure [ [ :x ] ]
- 1 > pr :x
- 1 > if < :x 100 [ output count100 + :x 1 ] [ output :x ] ]
-
- ? make "count [
- 1 > procedure [ [ :x ] ]
- 1 > pr :x
- 1 > count + :x 1
- 1 > stop ]
-
- In the second example the "stop" command is never executed, but it is
- necessary for LOGO to recognize the call to "count" as tail recursion,
- without it "count" would run out of memory.
-
-
- FILES * * * * * * * * * * * * * * * * * * * * * *
-
- Primitives are provided to save and load the contents of variables
- (including procedures), read and write data, save and load IFF images,
- attach icons to files, and get a filename through a file requester.
- The "save" primitive saves the contents of variables to a file as "make"
- commands. The "load" command executes a text file as if it were typed at
- the command window except that comments are ignored (a comment is
- everything from a semicolon ";" to the end of the line).
- To read or write a data file it must first be opened with "open" (a new
- file to be writen), or "openold" (an existing file to be read or appended).
- Each of these outputs a file pointer (a BCPL pointer to an AmigaDOS file
- handle) which must later be closed using "close". The primitives for
- reading and writing files accept a file-pointer as input and work much like
- their command window counterparts.
- The "saveimage", and "loadimage" primitives copy the contents of a
- window to or from an IFF ILBM file. For these to work the "ILBM.Library" by
- Software Dissidents must be in the LIBS: directory.
- The "filerequest" primitive outputs an AmigaDOS file name selected with
- the PathMaster file selector by Justin V. McCormick. "filerequest" may be
- used as input to any procedure that requires a file name.
-
-
- GRAPHICS * * * * * * * * * * * * * * * * * * * * * *
-
- Much of the Amiga graphics capability is available in Power LOGO.
- Primitives are provided to open custom intuition screens and windows, draw
- lines, patterned lines, text, flood fills, and copy regions.
- Graphics are rendered into windows which must first be opened with
- "openwindow". The window graphics primitives require a pointer to a window
- as an input. Coordinates within windows start with (0,0) in the upper left
- corner and count pixels to the right and down.
-
-
- TURTLES * * * * * * * * * * * * * * * * * * * * * *
-
- Turtles are graphics tools based on reletive movement. You may open many
- turtles, each is opened onto a window, has its own coordinate system, and
- has its own sense of location, distance, and direction, as well as its own
- foreground pen, background pen, draw mode, and line pattern.
- By default the turtle commands control all active turtles, but may be
- directed to control specific turtles (active or not). Turtle operations
- output information about one specified turtle.
-
-
- DEMONS * * * * * * * * * * * * * * * * * * * * * *
-
- A demon may be thought of as a process separate from your main program,
- that keeps testing for a particular kind of event. When the event is
- detected the demon interupts the main program and runs a special procedure.
- When the procedure is complete the main program will resume.
- There are four types of events that may trigger demons, menu selection,
- left mouse button, key stroke, and window close gadget. For each of these
- there is an event queue, when the event queue is not empty, the demon
- procedure will be run. The demon procedure must execute the appropriate get
- operation to remove the event from the queue, or the demon will run again
- and again.
- For a simple example of demons in action load the file Mouse-Paint. For
- examples of menu demons see the files LOGO-Startup, and Mandelbrot.
-
-
- ERRORS * * * * * * * * * * * * * * * * * * * * * *
-
- Errors in syntax, or anything the interpreter does not recognize as
- valid LOGO instructions, should produce meaningful error messages.
- Primitives that expect a pointer as input may cause LOGO to crash (guru)
- if passed a bad pointer.
- The primitives "repitem", and "represt" destructively change an existing
- list and must be used carefully. If there is more than one reference to the
- list all references will be changed. They can also result in circular lists
- which appear infinite, and may cause LOGO to get stuck in a loop.
-
-
- RECOMMENDED READING * * * * * * * * * * * * * * * * * * * * * *
-
- This document file describes the differences between Power LOGO and
- traditional versions of LOGO, these books will provide more background
- about LOGO. Two of these books, Computer Science Logo Style volume 1, and
- Visual Modeling with LOGO, include sections that may be helpful to
- beginners. There are many books available about programming in LOGO for
- beginners, however the ones that I have read are not very good, and none
- are listed here.
-
- Computer Science Logo Style
- Volume 1: Intermediate Programming, 1985.
- Volume 2: Projects, Styles, amd Techniques, 1986.
- Volume 3: Advanced Topics, 1987.
- Brian Harvey
- MIT Press.
- These are excellent books for anyone interested in programming, and
- computer science.
-
- Mindstorms: Children, Computers, and Powerful Ideas.
- Seymour Papert
- Basic Books, 1980
- This book is about education and how computers and programming may be
- used by children, parents, and teachers. Required reading for parents,
- and teachers interested in how children can make use of computers.
-
- Turtle Geometry: The Computer as a Medium for Exploring Mathematics.
- Harold Abelson, and Andrea diSessa
- MIT Press 1981
- About turtles as a tool for the study of mathematics, geometry, and
- topology.
-
- Visual Modeling with LOGO: A Structural Approach to Seeing.
- James Clayson
- MIT Press, 1988
- About using LOGO and turtle graphics for exploring visual ideas and
- relationships.
-
-
- LOGO PRIMITIVES * * * * * * * * * * * * * * * * * * * * * *
-
- Format for decriptions of primitives:
-
- NAME INPUTS ( OPTIONAL-INPUTS )
- SYNONYM ALTERNATIVE INPUTS
- INPUT = DESCRIPTION OF INPUT.
- FUNCTION DESCRIPTION.
-
- The Power LOGO primitive set:
-
- + number number ( number... )
- sum
- number = Any number.
- Addition, output the sum of all inputs.
-
- - number number ( number... )
- difference
- number = Any number.
- Subtraction, output first input minus all of the other inputs.
-
- * number number ( number... )
- product
- number = Any number.
- Multiplication, output product of all inputs.
-
- / number number ( number... )
- quotient
- number = Any number.
- Division, output first input divided by each of the other inputs.
-
- +- number
- negate
- number = Any number.
- Change sign, output opposite of input.
-
- > number number ( number... )
- number = Any number.
- Output true if first input is more than all others.
-
- < number number ( number... )
- number = Any number.
- Output true if first input is less than all others.
-
- >= number number ( number... )
- number = Any number.
- Output true if first input is more than or equal to all others.
-
- <= number number ( number... )
- number = Any number.
- Output true if first input is less than or equal to all others.
-
- =0 number ( number... )
- number = Any number.
- Output true if all inputs are equal to zero.
-
- <0 number ( number... )
- number = Any number.
- Output true if all inputs are less than zero.
-
- >0 number ( number... )
- number = Any number.
- Output true if all inputs are more than zero.
-
- abs number
- number = Any number.
- Output absolute value number.
-
- activelist
- Output list of pointers to active turtles.
-
- alphap word word
- word = Any word.
- Output true if words are in alphabetical order.
-
- and predicate predicate ( predicate... )
- predicate = true or false.
- Output true if all inputs are true.
-
- argslist
- Output list of startup arguments, the first item in the argslist is the
- file name of LOGO, the rest are the args from Workbench, or CLI.
-
- ascii word
- word = Any word.
- Output ASCII number of first character in word.
-
- atan tangent
- tangent = Any number.
- Inverse tangent, output angle for tangent.
-
- back distance ( turtle ... )
- bk distance ( turtle-list )
- distance = Number, distance in turtle steps.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Move turtles backward distance.
-
- buriedp object
- object = Any word or list.
- Output true if input is a buried variable name.
-
- burylist
- Output list of names that are buried.
-
- bury name ( name... )
- name-list ( name-list... )
- name = Word, a variable name.
- name-list = List of names.
- Hide and protect input variable names (hide from make,
- erase, namelist, etc.).
-
- butfirst object
- bf
- object = Any word or list.
- Output all but the first item of the input object.
-
- butlast object
- bl
- object = Any word or list.
- Output all but the last item of the input object.
-
- catch label run-list
- label = Any word.
- run-list = List of LOGO instructions.
- Execute run-list, set trap for matching throw. The label "error" may be
- used to trap errors.
-
- cd ( path )
- path = An AmigaDOS directory name (word or list).
- Set the current directory to the specified path, or output the current
- directory.
-
- char ascii
- ascii = Any number from 1 to 255.
- Output word containing one ASCII character.
-
- clean ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Blank turtles windows.
-
- cleartext
- Blank the command window.
-
- closep
- Output true if window-close queue is not empty.
-
- close file ( file... )
- file = BCPL pointer to AmigaDOS file handle.
- Close files.
-
- closescreen screen ( screen... )
- screen = Pointer to an intuition screen.
- Close screens.
-
- closeturtle turtle ( turtle... )
- turtle = Pointer to a turtle.
- Close turtles.
-
- closewindow window ( window... )
- window = Pointer to an intuition window.
- Close windows.
-
- conditional conditional-list
- cond
- conditional-list = A list: [ predicate-list run-list ... ]
- predicate-list = A run-list that outputs true or false.
- run-list = List of LOGO instructions.
- Execute the run-list following the first true predicate-list.
-
- copyrect window X Y window X Y width height
- window = Pointer to an intuition window.
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- width = Number, width of region in pixels.
- height = Number, height of region in pixels.
- Copy a rectangular region from window to window.
-
- cos angle
- angle = Number representing an angle.
- Output cosine of angle.
-
- count object
- object = Any word or list.
- Output number of items in object.
-
- cursor
- Output position-list of command window text cursor.
-
- degrees
- Interpret angles as degrees.
-
- dir ( path )
- path = An AmigaDOS directory name (word or list).
- Output list of contents of the specified path, or the current directory.
-
- doscommand command-line
- command-line = List containning an AmigaDOS command line.
- Run list as AmigaDOS command (as if typed at the CLI).
-
- dot ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Mark one pixel at turtles position.
-
- dowhile run-list predicate-list
- run-list = List of LOGO instructions.
- predicate-list = A run-list that outputs true or false.
- Execute run-list while predicate-list is true.
-
- downp turtle
- turtle = Pointer to a turtle.
- Output true if turtles pen is down.
-
- draw window X Y
- window = Pointer to an intuition window.
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Draw from a windows graphics cursor position to position X Y.
-
- emptyp object
- object = Any word or list.
- Output true if object is the empty list or word.
-
- eqp object object ( object... )
- object = Any word or list.
- Output true if all inputs refer to the same object.
-
- equalp object object ( object... )
- =
- object = Any word or list.
- Output true if objects are identical.
-
- erase name ( name... )
- name-list ( name-list... )
- name = Word, a variable name.
- name-list = List of names.
- Remove bindings (contents) of input names that are not buried. Or remove
- bindings of all input names.
-
- error
- Output list containing the error number, procedure name, primitive name,
- and the offending input from the most recent error.
-
- exor predicate predicate
- predicate = true or false.
- Output true if one input is true and one is false.
-
- filelist
- Output list of pointers to all open files.
-
- filerequest ( title )
- title = Word, title bar text.
- Output file path name selected from file requester. This is the
- PathMaster file selector by Justin V. McCormick.
-
- first object
- object = Any word or list.
- Output first item of object.
-
- firstput object object
- fput
- object = Any word or list.
- Output object made by adding first input to beginning of second input.
-
- floodol window X Y
- window = Pointer to an intuition window.
- Y = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Flood fill to outline.
-
- forward distance ( turtle ... )
- fd distance ( turtle-list )
- distance = Number, distance in turtle steps.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Move turtles forward distance.
-
- fprint file object ( object... )
- file = BCPL pointer to AmigaDOS file handle.
- object = Any word or list.
- Print object to file.
-
- fprintout file name ( name... )
- file name-list ( name-list... )
- file = BCPL pointer to AmigaDOS file handle.
- name = Word, a variable name.
- name-list = List of names.
- Print names and their bindings file.
-
- frac number
- number = Any number.
- Output fractional portion of number.
-
- freadbyte file
- file = BCPL pointer to AmigaDOS file handle.
- Output one byte number read from file, Output the empty list if end
- of file.
-
- freadlist file
- file = BCPL pointer to AmigaDOS file handle.
- Output list read from file (or the empty word if end of file).
-
- fshow file object ( object... )
- file = BCPL pointer to AmigaDOS file handle.
- object = Any word or list.
- Print object to file.
-
- ftype file object ( object... )
- file = BCPL pointer to AmigaDOS file handle.
- object = Any word or list.
- Print object to file.
-
- fwritebyte file number ( number... )
- file = BCPL pointer to AmigaDOS file handle.
- number = Any number from 0 to 255.
- Write one byte numbers to file.
-
- getclose
- Output a pointer to a window from the window close event queue, wait if
- the event queue is empty.
-
- getmenu
- Output list containing a pointer to the window, the menu number, item
- number, and subitem number of the next item from the menu event queue,
- wait if the menu event queue is empty.
-
- getmouse
- Output list containing a pointer to the window, the X position, and Y
- position where the mouse was when the button was pressed, wait if the
- mouse event queue is empty.
-
- getprop name property
- gprop
- name = Word, name of a veriable containing a property list.
- property = Word, label of an object in a property list.
- Output specified object from a property list.
-
- heading turtle
- turtle = Pointer to a turtle.
- Output a turtles heading.
-
- home ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Move turtles to position (0,0) set heading to 0.
-
- if predicate run-list run-list
- predicate = true or false.
- run-list = List of LOGO instructions.
- If predicate is true execute first run-list, if false execute second
- run-list. Both run-lists are required, if one case is not used, use the
- empty list [ ].
-
- int number
- number = Any number.
- Output integer portion of number.
-
- intuition action pointer ( ?... )
- action = A number from 1 to 11, specifing action to be taken.
- pointer = A pointer to an intuition screen or window.
- ? = Listed below.
- Eleven commands in one, to modify screens, windows, and menus.
-
- 1 screen X Y
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Move screen (screen = @0 for workbench screen).
-
- 2 window X Y
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Move window (window = @0 for command window).
-
- 3 window menu item subitem
- menu, item, subitem = Numbers specifing a menu or item.
- Off menu (window = @0 for command window).
-
- 4 window menu item subitem
- menu, item, subitem = Numbers specifing a menu or item.
- On menu (window = @0 for command window).
-
- 5 screen
- Screen to back (screen = @0 for workbench screen).
-
- 6 screen
- Screen to front (screen = @0 for workbench screen).
-
- 7 screen showit
- showit = Number.
- Show screen title (number <> 0) hide title (number = 0).
-
- 8 window width height
- width = Number, width of window in pixels.
- height = Number, height of window in pixels.
- Size window (window = @0 for command window).
-
- 9 window MinWidth MinHeight MaxWidth MaxHeight
- MinWidth \
- MinHeight \
- MaxWidth / = Numbers, sizes in pixels.
- MaxHeight /
- Set window limits (window = @0 for command window).
-
- 10 window
- Window to back (window = @0 for command window).
-
- 11 window
- Window to front (window = @0 for command window).
-
- item element object
- element = Number, index to item.
- object = Any word or list.
- Output specified item from object.
-
- items first count object
- first = Number, index to first item.
- count = Number of items.
- object = Any word or list.
- Output specified items from object.
-
- keyp
- Output true if character queue is not empty.
-
- last object
- object = Any word or list.
- Output last item from object.
-
- lastput object object
- lput
- object = Any word or list.
- Output object made by adding first input to end of second input.
-
- left angle ( turtle ... )
- lt angle ( turtle-list )
- angle = Number representing an angle.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Rotate turtle left.
-
- linep
- Output true if command window input line queue is not empty.
-
- listp object
- object = Any word or list.
- Output true if object is a list.
-
- list object object ( object... )
- object = Any word or list.
- Output list containing input objects.
-
- load file-name ( file-name... )
- file-name = An AmigaDOS file name (word or list).
- Load file, runs a text file as if it were typed at the keybord.
-
- loadimage window file-name
- window = Pointer to an intuition window.
- file-name = An AmigaDOS file name (word or list).
- Load a window from an IFF ILBM file. Requires "ilbm.library" from
- Dissidents Software. BUG: sometimes loads entire screen.
-
- log base number
- base = Positive number.
- number = Positive number.
- Output logarithm of the number to the base.
-
- make name object
- name = Word, a variable name.
- object = Any word or list.
- Make object the contents of name (bind object to name). Make is the LOGO
- variable assignment operator.
-
- memberp object object
- object = Any word or list.
- Output true if second object contains first object.
-
- menup
- Output true if menu queue is not empty.
-
- mousep
- Output true if mouse-button queue is not empty.
-
- mouse window
- window = Pointer to an intuition window.
- Output list containing the X position, Y position and button position of
- the mouse reletive to the window.
-
- move window X Y
- window = Pointer to an intuition window.
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Move a windows graphics cursor to position X Y.
-
- namelist
- Output list of variable names in use.
-
- namep object
- object = Any word or list.
- Output true if object is a variable name.
-
- new
- Remove bindings of all names (erase), close all files, close all
- turtles, close all windows, close all screens, clear all menus, clear
- all demons, flush all input queues, return to top level.
-
- not predicate
- predicate = true or false.
- Output true if input is false output false if input is true.
-
- numberp object
- object = Any word or list.
- Output true if object is a number.
-
- open file-name
- file-name = An AmigaDOS file name (word or list).
- Create or open file to be written, output BCPL pointer to an AmigaDOS
- file handle.
-
- openold file-name
- file-name = An AmigaDOS file name (word or list).
- Open existing file to be read or written, output BCPL pointer to an
- AmigaDOS file handle.
-
- openscreen vm ( d t le te w h dp bp )
- screen-data-list
- vm = Number, viewport modes, sum of:
- 1 = hires
- 2 = lace
- 4 = extra half brite
- d = Number of bit planes.
- t = List, title bar text.
- le = Number, left edge.
- te = Number, top edge.
- w = Number, width.
- h = Number, height.
- dp = Number, detail pen.
- bp = Number, block pen.
- screen-data-list = List containing some or all of the above.
- Default screen-data-list = [ 0 2 [ ] 0 0 320 200 0 1 ]
- if view modes = hires then default width = 640
- if view modes = lace then default height = 400
- if view modes = extra half brite then default depth = 6
- Open an intuition graphics screen, output pointer to the screen.
-
- openturtle window ( mag ar X Y h t )
- turtle-data-list
- window = Pointer to an intuition window.
- mag = Number, scale or magnification.
- ar = Number, aspect ratio, pixel width / height.
- X = Number, pixel x coordinate of home.
- Y = Number, pixel y coordinate of home.
- h = Number, heading of home.
- t = Number, turning direction, >= 0 clockwise,
- < 0 counterclockwise.
- turtle-data-list = List containing some or all of the above.
- Defaults:
- mag lores 1.8
- hires 3.2
- This means it takes 200 steps to go from the
- left edge to the right edge of a full screen.
- ar lores 0.88
- hires 0.44
- lores lace 1.76
- hires lace 0.88
- This makes circles look round and squares look
- square.
- X, Y The current center of the window.
- h 0 Straight up.
- t 0 Clockwise.
- Open a turtle, output pointer to the turtle.
-
-
-
- openwindow screen ( f t le te w h dp bp minw minh maxw maxh )
- window-data-list
- screen = Pointer to an intuition screen, @0 for workbench screen.
- f = Number, flags, sum of:
- 1 = drag gadget
- 2 = depth gadget
- 4 = close gadget
- 8 = size gadget
- 16 = give me zero zero
- 32 = backdrop
- 64 = borderless
- 128 = activate
- t = List, title bar text.
- le = Number, left edge.
- te = Number, top edge.
- w = Number, width.
- h = Number, height.
- dp = Number, detail Pen.
- bp = Number, block Pen.
- minw = Number, minimum width.
- minh = Number, minimum height.
- maxw = Number, maximum width.
- maxh = Number, maximum height.
- window-data-list = List containing some or all of the above.
- Default window-data-list WorkBench screen:
- [ @0 3 [ ] 0 0 320 200 0 1 30 30 640 400 ]
- Default window for custom screen:
- Backdrop borderless window to fit the screen.
- Open an intuition graphics window, output pointer to the window.
-
- or predicate predicate ( predicate... )
- predicate = true or false.
- Output true if any inputs are true.
-
- output object
- op
- object = Any word or list.
- Exit procedure, return object as the procedures output.
-
- pd ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Pen down, lower the turtles pen.
-
- peek bytes address
- bytes = Number, one of:
- 0 32 bit pointer
- 1 8 bit unsigned integer
- -1 8 bit signed integer
- 2 16 bit unsigned integer
- -2 16 bit signed integer
- 4 32 bit unsigned integer
- -4 32 bit signed integer
- 8 64 bit IEEE double floating point number
- address = Number, or pointer, a memory address.
- Output number contained at address.
-
- pen window ( type )
- window = Pointer to an intuition window (@0 for command window).
- type = Number, which pen:
- 0 foreground pen (default)
- 1 background pen
- 2 area outline pen
- Output the windows pen number.
-
- poerror
- Print out error message.
-
- pointerp object
- object = Any word or list.
- Output true if object is a pointer.
-
- poke bytes address number ( number... )
- bytes = Number of bytes:
- 1 8 bit integer
- 2 16 bit integer
- 4 32 bit integer or pointer
- 8 64 bit IEEE double floating point number
- address = Number, or pointer, a memory address.
- number = Number, or pointer, limited in size by number of bytes.
- Write numbers to memory address.
-
- power base exponent
- base = Any number.
- exponent = Number, if base < 0 then exponent must be an integer.
- Output base to the power of exponent.
-
- precision ( digits )
- digits = Number from 0 to 15.
- Sets or outputs precision used by print, fprint, type, ftype, and text
- when printing numbers.
-
- primitivep object
- object = Any word or list.
- Output true if object is a primitive.
-
- print object ( object... )
- pr
- object = Any word or list.
- Print object to command window.
-
- printout name ( name... )
- po name-list ( name-list... )
- name = Word, a variable name.
- name-list = List of names.
- Print names and their bindings to command window.
-
- procedurep object
- object = Any word or list.
- Output true if object is a user defined procedure.
-
- psum address number ( number... )
- address = Number, or pointer, a memory address.
- number = Any number.
- Output pointer equal to sum of address and numbers.
-
- pu ( turtle... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Pen up, raise the turtles pen.
-
- putprop name property object
- pprop
- name = Word, name of a veriable containing a property list.
- property = Word, label of an object in a property list.
- object = Any word or list.
- Place object into a property list.
-
- quit
- Exit LOGO return to WorkBench or CLI.
-
- radians
- Interpret angles as radians.
-
- rand
- Output random fraction from zero to less than one.
-
- random range
- range = Number, positive integer.
- Output random integer from zero to less than number.
-
- readchar
- rc
- Output one character word typed at keybord. Reads characters from
- windows other than the command window. Waits if character event queue
- is empty.
-
- readlist
- rl
- Output line typed at keybord as a list. Reads lines from the command
- window. Waits if line queue is empty.
-
- readpixel window X Y
- window = Pointer to an intuition window.
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Output pen number of pixel at position (X,Y).
-
- rectfill window l t r b
- window = Pointer to an intuition window.
- l = Number, left edge of rectangle in pixels.
- t = Number, top edge of rectangle in pixels.
- r = Number, right edge of rectangle in pixels.
- b = Number, bottom edge of rectangle in pixels.
- Fill rectangle from (l,t) to (r,b).
-
- recycle ( number )
- number = Any number.
- Without an input, recycles memory and frees any unused blocks.
- With an input, just recycles memory.
-
- remainder number number
- number = Any number.
- Output remainder after division.
-
- remprop name property
- name = Word, name of a veriable containing a property list.
- property = Word, label of an object in a property list.
- Remove object from a property list.
-
- repeat number run-list
- number = Number, positive integer.
- run-list = List of LOGO instructions.
- Execute run-list number of times.
-
- repitem item list object
- item = Number, index into list.
- list = Any list.
- object = Any word or list.
- Replace specified item of list with object. This is similar to "rplaca"
- in Lisp. WARNING: repitem destructively changes an existing list and you
- may obtain unexpected results if there is more than one reference to the
- list.
-
- represt item list object
- item = Number, index into list.
- list = Any list.
- object = Any word or list.
- Replace rest of list after specified item with object. This is similar
- to "rplacd" in Lisp. WARNING: represt destructively changes an existing
- list and you may obtain unexpected results if there is more than one
- reference to the list.
-
- restof number object
- item = Number, index into object.
- object = Any word or list.
- Output rest of object following specified item.
-
- rgb screen index
- screen = Pointer to an intuition screen.
- index = Number, index into the screens color table.
- Output list containing red, green, and blue value of the screens
- specified color.
-
- right angle ( turtle ... )
- rt angle ( turtle-list )
- angle = Number representing an angle.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Rotate turtle right.
-
- round number
- number = Any number.
- Output number rounded to nearest integer.
-
- run run-list
- run-list = List of LOGO instructions.
- Execute run-list.
-
- save file-name name ( name... )
- file-name name-list ( name-list... )
- file-name = An AmigaDOS file name (word or list).
- name = Word, a variable name.
- name-list = List of names.
- Save variable names and their contents to file.
-
- saveicon file-name ( default-tool tool-types )
- file-name = An AmigaDOS file name (".info" will be added).
- default-tool = Word.
- tool-types = List of up to three words.
- Attach icon to file.
-
- saveimage window file-name
- window = Pointer to an intuition window.
- file-name = An AmigaDOS file name (word or list).
- Save a window to an IFF ILBM file. Requires "ilbm.library" from
- Dissidents Software. BUG: sometimes saves entire screen.
-
- screenlist
- Output list of pointers to all open screens.
-
- seconds
- Output system clock time in seconds.
-
- seedrand ( number )
- number = Any number.
- Re-seed random number generator.
-
- seekend file
- file = BCPL pointer to AmigaDOS file handle.
- Move to end of file.
-
- seekstart file
- file = BCPL pointer to AmigaDOS file handle.
- Move to start of file.
-
- sentence object object ( object... )
- se
- object = Any word or list.
- Output list of input objects. Lists in the input to sentence will have
- their outer brackets removed. "sentence" always creates a new list.
-
- setafpt window pattern-list
- window = Pointer to an intuition window.
- pattern-list = A list of up to 16 words, each 16 characters long
- where "x" is an on pixel, any other character is an
- off pixel.
- Set area fill pattern.
-
- setcursor position
- position = List of two numbers, X, and Y coordinates.
- Set command window text cursor position.
-
- setdrmode window mode
- window = Pointer to an intuition window (@0 for command window).
- mode = Number, sum of:
- 0 = JAM1
- 1 = JAM2
- 2 = COMPLEMENT
- 4 = INVERSVID
- Set a windows draw mode.
-
- setfont window font-name font-height
- window = Pointer to an intuition window (@0 for command window).
- font-name = Word.
- font-height = Number.
- Set a windows text font.
-
- seth angle ( turtle ... )
- angle ( turtle-list )
- angle = Number representing an angle.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Set turtles heading.
-
- setlinept window pattern
- window = Pointer to an intuition window.
- pattern = Word 16 characters long where "x" is an on pixel, any
- other character is an off pixel.
- Set a windows line pattern.
-
- setmenu window menu-list
- window = Pointer to an intuition window (@0 for command window).
- menu-list = List of menu text:
- [ menu-name-1 [ item-1-1 K ]
- [ item-1-2 [ subitem-1-2-1 K ]
- [ subitem-1-2-2 K ] ]
- menu-name-2 [ item-2-1 ]
- [ item-2-2 ] ]
- (where "K" is a keybord short cut)
- Attach a menu strip to the window.
-
- setpen window pen ( type )
- window = Pointer to an intuition window (@0 for command window).
- pen = Number of pen.
- type = Number, which pen:
- 0 foreground pen (default)
- 1 background pen
- 2 area outline pen
- Set a windows pen number.
-
- setrgb screen index rgb-list
- screen = Pointer to an intuition screen.
- index = Number, index into color registers table.
- rgb-list = List of three numbers, containing red, green, and blue
- value of the color.
- Set a screens color register.
-
- setstyle window style
- window = Pointer to an intuition window (@0 for command window).
- style = Number, sum of:
- 0 = plain
- 1 = underlined
- 2 = bold
- 4 = italic
- Set the text rendering style.
-
- settdm mode ( turtle ... )
- mode ( turtle-list )
- mode = Number, sum of:
- 0 = JAM1
- 1 = JAM2
- 2 = COMPLEMENT
- 4 = INVERSVID
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Set turtles draw mode.
-
- settlp pattern ( turtle ... )
- pattern ( turtle-list )
- pattern = Word 16 characters long where "x" is an on pixel, any other
- character is an off pixel.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Set turtle line pattern.
-
- settpn pen type ( turtle ... )
- pen type ( turtle-list )
- pen = Number of pen.
- type = Number, which pen:
- 0 foreground pen
- 1 background pen
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Set turtles pen number.
-
- settpos position ( turtle ... )
- position ( turtle-list )
- position = List of two numbers, X, and Y coordinates.
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Set turtles position.
-
- show object ( object... )
- object = Any word or list.
- Print object to command window.
-
- sin angle
- angle = Number representing an angle.
- Output sine of angle.
-
- sleep
- Wait for an event (mouse, menu, keyboard, or window close).
-
- sqrt number
- number = Positive number.
- Output square root of number.
-
- stick
- Output list containing the X position, Y position and button position of
- a joystick in port number two.
-
- stop
- Exit procedure.
-
- system action ( ? )
- action = A number from 1 to 14, specifing action to be taken.
- ? = Listed below.
- Fourteen commands in one, to control memory, libraries, and demons.
-
- 1
- Output the amount of memory LOGO tries to hold in reserve.
-
- 2 bytes
- bytes = Number of bytes.
- Set the amount of memory LOGO tries to hold in reserve.
-
- 3 bytes
- bytes = Number of bytes.
- Allocate memory, output pointer to block.
-
- 4 bytes
- bytes = Number of bytes.
- Allocate chip memory, output pointer to block.
-
- 5 pointer
- pointer = Pointer to allocated memory.
- Free memory.
-
- 6
- Output list of pointers to allocated memory blocks.
-
- 7
- Open Diskfont library.
-
- 8
- Close Diskfont library.
-
- 9
- Open ILBM library.
-
- 10
- Close ILBM library.
-
- 11
- Enable demons.
-
- 12
- Disable demons.
-
- 13
- Open Icon library.
-
- 14
- Close Icon library.
-
- tan angle
- angle = Number representing an angle.
- Output tangent of angle.
-
- tell turtle ( turtle... )
- turtle-list
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Make these the active turtles.
-
- text window object
- window = Pointer to an intuition window.
- object = Any word or list.
- Print text to a custom window.
-
- thing name
- name = Word, a variable name.
- Output object bound to name (contents of variable).
-
- throw label
- label = Any word.
- Escape to catch with matching label.
-
- toplevel
- Exit program return to top level.
-
- toward position turtle
- position = List of two numbers, X, and Y coordinates.
- turtle = Pointer to a turtle.
- Output heading to point turtle toward position.
-
- tpen turtle ( type )
- turtle = Pointer to a turtle.
- type = Number, which pen:
- 0 foreground pen (default)
- 1 background pen
- Output the turtles pen number.
-
- tpos turtle
- turtle = Pointer to a turtle.
- Output a list containing the turtles position.
-
- turtlelist
- Output list of pointers to all open turtles.
-
- turtleoff ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Deactivate turtles.
-
- turtleon ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Activate turtles.
-
- twpos turtle
- turtle = Pointer to a turtle.
- Output Turtles position in window coordinates.
-
- type object ( object... )
- object = Any word or list.
- Print object to command window.
-
- unbury name ( name... )
- name-list ( name-list... )
- name = Word, a variable name.
- name-list = List of names.
- Make variable names accessable.
-
- wait seconds
- seconds = Positive number.
- Pause for a number of seconds.
-
- whenchar run-list
- run-list = List of LOGO instructions.
- Set demon to run when key stroke is detected. Run-list must execute a
- "readchar" to clear the character queue.
-
- whenclose run-list
- run-list = List of LOGO instructions.
- Set demon to run when window-close is detected. Run-list must execute a
- "getclose" to clear the window-close queue.
-
- whenmenu run-list
- run-list = List of LOGO instructions.
- Set demon to run when menu item is selected. Run-list must execute a
- "getmenu" to clear the menu-selection queue.
-
- whenmouse run-list
- run-list = List of LOGO instructions.
- Set demon to run when mouse-button is pressed. Run-list must execute a
- "getmouse" to clear the mouse-button queue.
-
- while predicate-list run-list
- predicate-list = A run-list that outputs true or false.
- run-list = List of LOGO instructions.
- While predicate-list is true, repeat run-list.
-
- window ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Allow turtle to move beyond edges of window.
-
- windowlist
- Output list of pointers to all open windows.
-
- word word word ( word... )
- word = Any word.
- Output word made up of input words.
-
- wordp object
- object = Any word or list.
- Output true if object is a word.
-
- wrap ( turtle ... )
- ( turtle-list )
- turtle = Pointer to a turtle.
- turtle-list = List of turtle pointers.
- Make turtle wrap around at edges of window.
-
- writepixel window X Y
- window = Pointer to an intuition window.
- X = Number, pixel x coordinate.
- Y = Number, pixel y coordinate.
- Set pixel (X,Y) to the pen color.
-
- wtpos turtle
- turtle = Pointer to a turtle.
- Output windows position in turtle coordinates.
-
-
- PLEASE HELP ME * * * * * * * * * * * * * * * * * * * * * *
-
- Help me to improve this version of LOGO. Please contact me with any
- comments or bug reports.
-
- Gary Teachout
- 10532 66 Place, W
- Everett, WA 98204
- USA
-
-